# -*- coding:utf8 -*- #
# -----------------------------------------------------------------------------------
# ProjectName:  smalleel-hvac-iot-test
# FileName:     command_.py
# Author  :     
# Datetime:     2023/5/24 14:20
# Description：
# -----------------------------------------------------------------------------------

# 单个设备params
def vrv_control_params(deviceNo, iDUAddr) -> dict:
    params = {
        # 基站编号
        "deviceNo": deviceNo,
        # 室内机地址
        "addr": iDUAddr,
        # 复合指令
        # 1：开关锁定
        # 2：温度锁定
        # 3：开关、温度锁定
        # 4：模式锁定
        # 5：模式、开关锁定
        # 6：模式、温度锁定
        # 7：模式、温度、开关锁定
        # 8：关闭并锁定面板
        # 9：解锁并开启面板
        # 10：面板锁定
        "complexLock": 0,
        # 设置面板开关 0：关闭；1：打开
        "switchOn": 0,
        # 面板运行模式 1：制冷；2：制热；3：送风；4：除湿
        "operate": 256,
        # 面板设置温度 16 - 32 摄氏度
        "temp": 256,
        # 面板设置风速  1：低速；2：中速；3：高速；4微风
        "speed": 256,
        # 设置温度锁定上限  17 ~ 31 摄氏度
        "upper": 256,
        # 设置温度锁定下限  17 ~ 31 摄氏度
        "floor": 256
    }
    return params


# 批量异步控制params
def vrv_asyncBatch_params(deviceNo, addrList: list) -> dict:
    paramsList = []
    for i in range(len(addrList)):
        listDict = {"speed": 256, "floor": 256, "addr": addrList[i], "temp": 256, "operate": 2, "upper": 0,
                    "complexLock": 0, "switchOn": 1}
        paramsList.append(listDict)
    params = {
        "deviceNo": deviceNo,
        "list": paramsList
    }
    return params


def collector_control_params(deviceNo: str):
    params = {
        # 基站编号
        "deviceNo": deviceNo,
        # 控制指令：restart 重启
        "action": "restart",
        # 指令值 1：基站；2：主机
        "data": 1
    }
    return params


# 基站上报周期
def collectro_cycle_params(deviceNo: str):
    params = {
        # 基站编号
        "deviceNo": deviceNo,
        "cycle": 10
    }
    return params


# 获取关联关系
def get_relation_params(deviceNo: str):
    params = {
        # 基站编号
        "deviceNo": deviceNo,
        "address": [1,2,3,4],
        "mark": 0,
    }
    return params


if __name__ == '__main__':
    addlist = [
        "C40000002999node1228978696",
        "C40000002999node156479117",
        "C40000002999node1186698610",
        "C40000002999node2146790346",
        "C40000002999node2113752214",
        "C40000002999node2189346192",
        "C40000002999node3235337814",
        "C40000002999node3197905570",
        "C40000002999node3231122400",
        "C40000002999node466375150",
        "C40000002999node4168541733",
        "C40000002999node415810184",
        "C40000000010node168530682"]
    print(vrv_asyncBatch_params(11, addlist))
